package com.example.mvp_test;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity implements IMainBussiess.IMainView, View.OnClickListener {

    private static final String TAG = "MainActivity";
    private MainPresenter mainPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mainPresenter = new MainPresenter(this);
        findViewById(R.id.main_btn).setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.main_btn) {
            mainPresenter.getDataFromNet();
        }
    }

    @Override
    public void showNetData(ArrayList<String> strings) {
        for (int i = 0; i < strings.size(); i++) {
            Log.i(TAG, "showNetData: " + strings.get(i));
        }
    }
}